//
//  ForMyCommentCtl.m
//  diaoyuren
//
//  Created by 钓鱼人 on 16/4/20.
//  Copyright © 2016年 game. All rights reserved.
//

#import "ForMyCommentCtl.h"
#import "ForMyCommentCell.h"
#import "TextPutView.h"

@interface ForMyCommentCtl ()<UITableViewDataSource,UITableViewDelegate,TextPutViewDeleget>

@property (nonatomic,strong) RootTableview *tableview;
@property (nonatomic,assign) CGFloat cellHight;

@property (nonatomic,strong) TextPutView *textPutview;
@end

@implementation ForMyCommentCtl

-(TextPutView *)textPutview{
    if (!_textPutview) {
        _textPutview = [[TextPutView alloc]initWithFrame:self.view.bounds];
        _textPutview.alpha = 0;
        _textPutview.deleget = self;
        [self.view addSubview:_textPutview];
        [self.view sendSubviewToBack:_textPutview];
        
        
//        _textPutview.inputBar.placeHolder = @"说点什么呢?";
//        _textPutview.alpha = 1;
//        [_textPutview.inputBar.textView becomeFirstResponder];

    }
    

    return _textPutview;
}
/**
 *  点击发送  调用方法
 */
-(void)DidSender:(NSString *)sendText{

//    SelectthreadModel *model = self.selecModel.thread;
//    NSDictionary *dic = @{
//                          @"fid":model.fid,
//                          @"tid":model.tid,
//                          @"message":sendText,
//                          @"formhash":self.selecModel.formhash,
//                          @"replysubmit":@"yes",
//                          @"repquote":self.pid,
//                          };
//    [[Manager sharedManager]ResponseWhithURL:CommentUrl AndParameter:dic AndCompletionType:^(id responseObject, DIEError *error) {
//        
//        //                NSLog(@"%@",responseObject);
//        //
//        //                NSLog(@"%@",responseObject[@"message"]);
//        
//    }];


}

-(void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    self.app.myTabBar.tabBar.hidden = YES;
    self.navigationController.navigationBar.hidden = YES;
    StatusBlack;
}
- (IBAction)backAction:(id)sender {
    
    [self.navigationController popViewControllerAnimated:YES];
}


- (void)viewDidLoad {
    [super viewDidLoad];
    self.tableview = [[RootTableview alloc]initWithFrame:CGRectMake(0, 64, SCREEN_WIDTH, SCREEN_HEIGHT-64) style:UITableViewStylePlain];
    self.tableview.delegate = self;
    self.tableview.dataSource = self;
    
    [self.tableview registerNib:[UINib nibWithNibName:@"ForMyCommentCell" bundle:nil] forCellReuseIdentifier:@"cell"];
    [self.view addSubview:self.tableview];
    self.tableview.separatorStyle = 0;
    self.tableview.backgroundColor = tabPlainBackColor;
    
    [self AchiveDataWhithPage:1];
}

-(void)AchiveDataWhithPage:(NSInteger)page{
    
    [[Manager sharedManager]RequestWhithURL:[NSString stringWithFormat:MyComment,page] AndParameter:nil AndCompletionType:^(id responseObject, DIEError *error) {
        
                NSLog(@"%@",responseObject);
        
    }];
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    
    return 10;
}

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    return self.cellHight;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    ForMyCommentCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
    self.cellHight = cell.cellHight;
    return cell;
}

@end